package com.feihong.yw189.adapter;

import android.content.Context;

import com.feihong.yw189.R;
import com.feihong.yw189.listener.ItemClickListener;
import com.feihong.yw189.model.User.message.SystemMessageListModel;
import com.holenzhou.pullrecyclerview.BaseRecyclerAdapter;
import com.holenzhou.pullrecyclerview.BaseViewHolder;

import java.util.ArrayList;

/**
 * @Author wangziheng
 * @ProjectName ywydt
 * @ClassName MsgAdapter
 * @package com.feihong.yw189.adapter
 * @data 2018/11/6 15:49
 * @Describe
 * @Change
 */
public class MsgAdapter extends BaseRecyclerAdapter<SystemMessageListModel.DataBean.ListBean> {
    public MsgAdapter(Context context){
        super(context,R.layout.my_system_message_item,new ArrayList<>());
    }

    @Override
    protected void convert(BaseViewHolder holder, SystemMessageListModel.DataBean.ListBean item) {
        holder.setText(R.id.sys_mess_time,item.getAdd_time());
        holder.setText(R.id.sys_mess_title,item.getMsg_title());
        holder.setText(R.id.sys_mess_type,item.getType());
        holder.itemView.setOnClickListener(v -> {
            if(mItemClickListener != null){
                mItemClickListener.onItemClick(item);
            }
        });
    }
    private ItemClickListener<SystemMessageListModel.DataBean.ListBean> mItemClickListener;
    public void setOnItemClickListener(ItemClickListener<SystemMessageListModel.DataBean.ListBean> itemClickListener){
        mItemClickListener = itemClickListener;
    }
}
